﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WarriorRush.GameDynamics.Utilities;

namespace WarriorRush.GameDynamics.SpecialAbilities
{
    public class Range : SpecialAbility
    {

        public Range()
            : base()
        {
            ReplacesAttack = true;
            RequiresAddtionalTarget = true;
            AbilityType = AbilityTypes.Range;
        }


        public override bool Execute(CharacterClass abilityTarget, Arena arena, List<CharacterClass> additonalTargets)
        {
            var attackTarget = additonalTargets.FirstOrDefault();
            attackTarget.TakeDamage(AbilityOwner.Stats.Attack);
            return base.Execute(abilityTarget, arena, additonalTargets);
        }
        public override void CalculateTargets()
        {
 	        Targets = new List<SimplePoint> { new SimplePoint(0,0)};
            for(var n = 1 ; n <= Power; n++)
            {
                Targets.Add(new SimplePoint(0,n));
                Targets.Add(new SimplePoint(0, -n));
            }
        }

        public override SpecialAbility GetInstance(int power)
        {
            var newInstance = new Range();
            newInstance.Power = power;
            newInstance.CalculateTargets();
            return newInstance;
        }


    }
}
